<?php

use yii\db\Migration;

/**
 * Class m171121_081942_addColumnToUser
 */
class m171121_081942_addColumnToUser extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $this->addColumn('{{%user}}','access_token',$this->string(1000)->notNull()->defaultValue('')->comment('用户登录授权码'));
        $this->addColumn('{{%user}}','expired_at',$this->integer()->notNull()->unsigned()->defaultValue(0)->comment('用户过期时间'));
    }

    /**
     * @inheritdoc
     */
    public function safeDown()
    {
        $this->dropColumn('{{%user}}','access_token');
        $this->dropColumn('{{%user}}','expired_at');
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m171121_081942_addColumnToUser cannot be reverted.\n";

        return false;
    }
    */
}
